<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<form action="http://192.168.109.129:9527/admin/login" method="get">
			<input name="username" type="text" value="admin" />
			<input name="password" type="password" value="macro123" />
			<button>登录</button>
		</form>
		<hr />

		<form action="http://192.168.109.129:9527/admin/login" method="post">
			<input name="username" type="text" value="admin" />
			<input name="password" type="password" value="macro123" />
			<button>登录</button>
		</form>
	</body>

	<script>
		let str = 'admin-macro123-新加的列-男-20190101-2000-办事员-20';
		let arr = str.split('-'); // 根据指定字符来分隔字符串
		console.log('账号：', arr[0]);
		console.log('密码：', arr[1]);
		console.log('性别：', arr[2]);
		console.log('入职日期：', arr[3]);
		console.log('工资：', arr[4]);
		console.log('职位：', arr[5]);
		console.log('部门编号：', arr[6]);
		str = 'admin123-macro123';
		console.log(str.split('-')); // 根据指定字符来分隔字符串

		let emp = `{
		  "password": "macro123",
		  "username": "admin",
		  "ssex": "男",
		  "age": 18,
		  "hobby": ["Java", "打游戏", "学习"],
		  "pets": [
			  {"name": "小庞", "type": "哈士奇","age": 10},
			  {"name": "张三", "type": "猫","age": 5},
			  {"name": "sb", "type": "猪", "age": 2}
		  ],
		  "addr": {"sheng": "广东省", "shi": "广州市", "qu": "黄埔区"},
		  "girl": null,
		  "haha": "null"
		}`;
		let obj = JSON.parse(emp); // 将json字符串转换为javascript中的json对象
		console.log('账号：', obj.username);
		console.log('密码：', obj.password);
		console.log('性别：', obj.ssex);
		console.log('性别：', obj.age);
		console.log('性别：', obj.hobby);
		console.log('性别：', obj.pets);
		console.log('性别：', obj.addr);
		console.log('性别：', obj.girl);

		//写一个三层数据的json字符串，分别为省市区
		let ssq = `
			[
				{
					"name": "广东省",
					"children": [{
						"name": "广州市",
						"children": [
							{"name": "黄埔区"},
							{"name": "天河区"},
							{"name": "白云区"}
						]
					}]
				},
				{
					"name": "湖南省",
					"children": [{
						"name": "衡阳市",
						"children": [
							{"name": "雁峰区"},
							{"name": "蒸湘区"},
							{"name": "衡阳县"}
						]
					}]
				}
			]
		`;
		obj = JSON.parse(ssq);
		console.log(obj);
	</script>
</html>
